3.1.81 \(\int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx\) [81]

3.1.81.1 Optimal result
3.1.81.2 Mathematica [B] (verified)
3.1.81.3 Rubi [A] (verified)
3.1.81.4 Maple [A] (verified)
3.1.81.5 Fricas [A] (verification not implemented)
3.1.81.6 Sympy [F]
3.1.81.7 Maxima [A] (verification not implemented)
3.1.81.8 Giac [A] (verification not implemented)
3.1.81.9 Mupad [B] (verification not implemented)

3.1.81.1 Optimal result

Integrand size = 28, antiderivative size = 119 \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=\frac {1}{2} \left (a^4+6 a^2 b^2-3 b^4\right ) x-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d} \]

output
1/2*(a^4+6*a^2*b^2-3*b^4)*x-4*a*b^3*ln(sin(d*x+c))/d+4*a*b^3*ln(tan(d*x+c) 
)/d+1/2*(4*a*b*(a^2-b^2)+(a^4-6*a^2*b^2+b^4)*cot(d*x+c))*sin(d*x+c)^2/d+b^ 
4*tan(d*x+c)/d
 
3.1.81.2 Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(477\) vs. \(2(119)=238\).

Time = 6.35 (sec) , antiderivative size = 477, normalized size of antiderivative = 4.01 \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=\frac {b^3 \left (\frac {\cos ^2(c+d x) (a+b \tan (c+d x))^5 \left (b^2+a b \tan (c+d x)\right )}{2 b^4 \left (a^2+b^2\right )}-\frac {\left (-5 a^2+3 b^2\right ) \left (\frac {1}{2} \left (4 a (a-b) (a+b)+\frac {a^4-6 a^2 b^2+b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+\frac {1}{2} \left (4 a (a-b) (a+b)-\frac {a^4-6 a^2 b^2+b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+b \left (6 a^2-b^2\right ) \tan (c+d x)+2 a b^2 \tan ^2(c+d x)+\frac {1}{3} b^3 \tan ^3(c+d x)\right )+4 a \left (\frac {1}{2} \left (5 a^4-10 a^2 b^2+b^4+\frac {a^5-10 a^3 b^2+5 a b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+\frac {1}{2} \left (5 a^4-10 a^2 b^2+b^4-\frac {a^5-10 a^3 b^2+5 a b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+5 a b \left (2 a^2-b^2\right ) \tan (c+d x)+\frac {1}{2} b^2 \left (10 a^2-b^2\right ) \tan ^2(c+d x)+\frac {5}{3} a b^3 \tan ^3(c+d x)+\frac {1}{4} b^4 \tan ^4(c+d x)\right )}{2 b^2 \left (a^2+b^2\right )}\right )}{d} \]

input
Integrate[Sec[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x])^4,x]
 
output
(b^3*((Cos[c + d*x]^2*(a + b*Tan[c + d*x])^5*(b^2 + a*b*Tan[c + d*x]))/(2* 
b^4*(a^2 + b^2)) - ((-5*a^2 + 3*b^2)*(((4*a*(a - b)*(a + b) + (a^4 - 6*a^2 
*b^2 + b^4)/Sqrt[-b^2])*Log[Sqrt[-b^2] - b*Tan[c + d*x]])/2 + ((4*a*(a - b 
)*(a + b) - (a^4 - 6*a^2*b^2 + b^4)/Sqrt[-b^2])*Log[Sqrt[-b^2] + b*Tan[c + 
 d*x]])/2 + b*(6*a^2 - b^2)*Tan[c + d*x] + 2*a*b^2*Tan[c + d*x]^2 + (b^3*T 
an[c + d*x]^3)/3) + 4*a*(((5*a^4 - 10*a^2*b^2 + b^4 + (a^5 - 10*a^3*b^2 + 
5*a*b^4)/Sqrt[-b^2])*Log[Sqrt[-b^2] - b*Tan[c + d*x]])/2 + ((5*a^4 - 10*a^ 
2*b^2 + b^4 - (a^5 - 10*a^3*b^2 + 5*a*b^4)/Sqrt[-b^2])*Log[Sqrt[-b^2] + b* 
Tan[c + d*x]])/2 + 5*a*b*(2*a^2 - b^2)*Tan[c + d*x] + (b^2*(10*a^2 - b^2)* 
Tan[c + d*x]^2)/2 + (5*a*b^3*Tan[c + d*x]^3)/3 + (b^4*Tan[c + d*x]^4)/4))/ 
(2*b^2*(a^2 + b^2))))/d
 
3.1.81.3 Rubi [A] (verified)

Time = 0.41 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.08, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3042, 3567, 532, 25, 2333, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a \cos (c+d x)+b \sin (c+d x))^4}{\cos (c+d x)^2}dx\)

\(\Big \downarrow \) 3567

\(\displaystyle -\frac {\int \frac {(b+a \cot (c+d x))^4 \tan ^2(c+d x)}{\left (\cot ^2(c+d x)+1\right )^2}d\cot (c+d x)}{d}\)

\(\Big \downarrow \) 532

\(\displaystyle -\frac {-\frac {1}{2} \int -\frac {\left (2 b^4+8 a \cot (c+d x) b^3+\left (a^4+6 b^2 a^2-b^4\right ) \cot ^2(c+d x)\right ) \tan ^2(c+d x)}{\cot ^2(c+d x)+1}d\cot (c+d x)-\frac {4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)}{2 \left (\cot ^2(c+d x)+1\right )}}{d}\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {\frac {1}{2} \int \frac {\left (2 b^4+8 a \cot (c+d x) b^3+\left (a^4+6 b^2 a^2-b^4\right ) \cot ^2(c+d x)\right ) \tan ^2(c+d x)}{\cot ^2(c+d x)+1}d\cot (c+d x)-\frac {4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)}{2 \left (\cot ^2(c+d x)+1\right )}}{d}\)

\(\Big \downarrow \) 2333

\(\displaystyle -\frac {\frac {1}{2} \int \left (2 \tan ^2(c+d x) b^4+8 a \tan (c+d x) b^3+\frac {a^4+6 b^2 a^2-8 b^3 \cot (c+d x) a-3 b^4}{\cot ^2(c+d x)+1}\right )d\cot (c+d x)-\frac {4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)}{2 \left (\cot ^2(c+d x)+1\right )}}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {\frac {1}{2} \left (\left (a^4+6 a^2 b^2-3 b^4\right ) \arctan (\cot (c+d x))-4 a b^3 \log \left (\cot ^2(c+d x)+1\right )+8 a b^3 \log (\cot (c+d x))-2 b^4 \tan (c+d x)\right )-\frac {4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)}{2 \left (\cot ^2(c+d x)+1\right )}}{d}\)

input
Int[Sec[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x])^4,x]
 
output
-((-1/2*(4*a*b*(a^2 - b^2) + (a^4 - 6*a^2*b^2 + b^4)*Cot[c + d*x])/(1 + Co 
t[c + d*x]^2) + ((a^4 + 6*a^2*b^2 - 3*b^4)*ArcTan[Cot[c + d*x]] + 8*a*b^3* 
Log[Cot[c + d*x]] - 4*a*b^3*Log[1 + Cot[c + d*x]^2] - 2*b^4*Tan[c + d*x])/ 
2)/d)
 

3.1.81.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 532
Int[(x_)^(m_)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbo 
l] :> With[{Qx = PolynomialQuotient[x^m*(c + d*x)^n, a + b*x^2, x], e = Coe 
ff[PolynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 0], f = Coeff[Pol 
ynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 1]}, Simp[(a*f - b*e*x) 
*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + Simp[1/(2*a*(p + 1))   Int[x^m 
*(a + b*x^2)^(p + 1)*ExpandToSum[2*a*(p + 1)*(Qx/x^m) + e*((2*p + 3)/x^m), 
x], x], x]] /; FreeQ[{a, b, c, d}, x] && IGtQ[n, 0] && ILtQ[m, 0] && LtQ[p, 
 -1] && IntegerQ[2*p]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2333
Int[(Pq_)*((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ 
ExpandIntegrand[(c*x)^m*Pq*(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, m}, x] 
&& PolyQ[Pq, x] && IGtQ[p, -2]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3567
Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*si 
n[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[x^m*((b 
+ a*x)^n/(1 + x^2)^((m + n + 2)/2)), x], x, Cot[c + d*x]], x] /; FreeQ[{a, 
b, c, d}, x] && IntegerQ[n] && IntegerQ[(m + n)/2] && NeQ[n, -1] &&  !(GtQ[ 
n, 0] && GtQ[m, 1])
 
3.1.81.4 Maple [A] (verified)

Time = 1.30 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.30

method result size
derivativedivides \(\frac {a^{4} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-2 \cos \left (d x +c \right )^{2} a^{3} b +6 a^{2} b^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+4 a \,b^{3} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+b^{4} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(155\)
default \(\frac {a^{4} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-2 \cos \left (d x +c \right )^{2} a^{3} b +6 a^{2} b^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+4 a \,b^{3} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+b^{4} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(155\)
parts \(\frac {a^{4} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {b^{4} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}+\frac {4 a \,b^{3} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}+\frac {6 a^{2} b^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 a^{3} b}{d \sec \left (d x +c \right )^{2}}\) \(166\)
parallelrisch \(\frac {32 a \,b^{3} \ln \left (\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right ) \cos \left (d x +c \right )-32 a \,b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \cos \left (d x +c \right )-32 a \,b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \cos \left (d x +c \right )+\left (a^{4}-6 a^{2} b^{2}+b^{4}\right ) \sin \left (3 d x +3 c \right )+4 \left (-a^{3} b +a \,b^{3}\right ) \cos \left (3 d x +3 c \right )+4 \left (a^{4} d x +6 a^{2} b^{2} d x -3 b^{4} d x +a^{3} b -a \,b^{3}\right ) \cos \left (d x +c \right )+\sin \left (d x +c \right ) \left (a^{2}-3 b^{2}\right )^{2}}{8 d \cos \left (d x +c \right )}\) \(196\)
risch \(-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} a^{4}}{8 d}+\frac {a^{4} x}{2}+3 a^{2} b^{2} x -\frac {3 b^{4} x}{2}-\frac {{\mathrm e}^{2 i \left (d x +c \right )} a^{3} b}{2 d}+\frac {{\mathrm e}^{2 i \left (d x +c \right )} a \,b^{3}}{2 d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} b^{4}}{8 d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} a^{4}}{8 d}+\frac {3 i {\mathrm e}^{2 i \left (d x +c \right )} a^{2} b^{2}}{4 d}-\frac {{\mathrm e}^{-2 i \left (d x +c \right )} a^{3} b}{2 d}+\frac {{\mathrm e}^{-2 i \left (d x +c \right )} a \,b^{3}}{2 d}+\frac {2 i b^{4}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {8 i a \,b^{3} c}{d}-\frac {3 i {\mathrm e}^{-2 i \left (d x +c \right )} a^{2} b^{2}}{4 d}+4 i x a \,b^{3}-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} b^{4}}{8 d}-\frac {4 a \,b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(271\)
norman \(\frac {\left (-\frac {1}{2} a^{4}-3 a^{2} b^{2}+\frac {3}{2} b^{4}\right ) x +\left (-\frac {3}{2} a^{4}-9 a^{2} b^{2}+\frac {9}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (\frac {1}{2} a^{4}+3 a^{2} b^{2}-\frac {3}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}+\left (\frac {3}{2} a^{4}+9 a^{2} b^{2}-\frac {9}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (-a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\frac {\left (8 a^{3} b -8 a \,b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}}{d}-\frac {8 b^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}-\frac {8 b^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}+\frac {2 \left (a^{4}-6 a^{2} b^{2}-5 b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {\left (a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {\left (a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}-\frac {2 \left (4 a^{3} b -4 a \,b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{d}+\frac {2 \left (4 a^{3} b -4 a \,b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{d}-\frac {\left (8 a^{3} b -8 a \,b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right ) \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{4}}-\frac {4 a \,b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}-\frac {4 a \,b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}+\frac {4 a \,b^{3} \ln \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}{d}\) \(528\)

input
int(sec(d*x+c)^2*(cos(d*x+c)*a+b*sin(d*x+c))^4,x,method=_RETURNVERBOSE)
 
output
1/d*(a^4*(1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c)-2*cos(d*x+c)^2*a^3*b+6* 
a^2*b^2*(-1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c)+4*a*b^3*(-1/2*sin(d*x+c 
)^2-ln(cos(d*x+c)))+b^4*(sin(d*x+c)^5/cos(d*x+c)+(sin(d*x+c)^3+3/2*sin(d*x 
+c))*cos(d*x+c)-3/2*d*x-3/2*c))
 
3.1.81.5 Fricas [A] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.14 \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=-\frac {8 \, a b^{3} \cos \left (d x + c\right ) \log \left (-\cos \left (d x + c\right )\right ) + 4 \, {\left (a^{3} b - a b^{3}\right )} \cos \left (d x + c\right )^{3} - {\left (2 \, a^{3} b - 2 \, a b^{3} + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} d x\right )} \cos \left (d x + c\right ) - {\left (2 \, b^{4} + {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]

input
integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^4,x, algorithm="fricas" 
)
 
output
-1/2*(8*a*b^3*cos(d*x + c)*log(-cos(d*x + c)) + 4*(a^3*b - a*b^3)*cos(d*x 
+ c)^3 - (2*a^3*b - 2*a*b^3 + (a^4 + 6*a^2*b^2 - 3*b^4)*d*x)*cos(d*x + c) 
- (2*b^4 + (a^4 - 6*a^2*b^2 + b^4)*cos(d*x + c)^2)*sin(d*x + c))/(d*cos(d* 
x + c))
 
3.1.81.6 Sympy [F]

\[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=\int \left (a \cos {\left (c + d x \right )} + b \sin {\left (c + d x \right )}\right )^{4} \sec ^{2}{\left (c + d x \right )}\, dx \]

input
integrate(sec(d*x+c)**2*(a*cos(d*x+c)+b*sin(d*x+c))**4,x)
 
output
Integral((a*cos(c + d*x) + b*sin(c + d*x))**4*sec(c + d*x)**2, x)
 
3.1.81.7 Maxima [A] (verification not implemented)

Time = 0.31 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.13 \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=\frac {8 \, a^{3} b \sin \left (d x + c\right )^{2} + {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{4} + 6 \, {\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} b^{2} - 8 \, {\left (\sin \left (d x + c\right )^{2} + \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )} a b^{3} - 2 \, {\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} b^{4}}{4 \, d} \]

input
integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^4,x, algorithm="maxima" 
)
 
output
1/4*(8*a^3*b*sin(d*x + c)^2 + (2*d*x + 2*c + sin(2*d*x + 2*c))*a^4 + 6*(2* 
d*x + 2*c - sin(2*d*x + 2*c))*a^2*b^2 - 8*(sin(d*x + c)^2 + log(sin(d*x + 
c)^2 - 1))*a*b^3 - 2*(3*d*x + 3*c - tan(d*x + c)/(tan(d*x + c)^2 + 1) - 2* 
tan(d*x + c))*b^4)/d
 
3.1.81.8 Giac [A] (verification not implemented)

Time = 0.39 (sec) , antiderivative size = 128, normalized size of antiderivative = 1.08 \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=\frac {4 \, a b^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, b^{4} \tan \left (d x + c\right ) + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} {\left (d x + c\right )} - \frac {4 \, a b^{3} \tan \left (d x + c\right )^{2} - a^{4} \tan \left (d x + c\right ) + 6 \, a^{2} b^{2} \tan \left (d x + c\right ) - b^{4} \tan \left (d x + c\right ) + 4 \, a^{3} b}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \]

input
integrate(sec(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c))^4,x, algorithm="giac")
 
output
1/2*(4*a*b^3*log(tan(d*x + c)^2 + 1) + 2*b^4*tan(d*x + c) + (a^4 + 6*a^2*b 
^2 - 3*b^4)*(d*x + c) - (4*a*b^3*tan(d*x + c)^2 - a^4*tan(d*x + c) + 6*a^2 
*b^2*tan(d*x + c) - b^4*tan(d*x + c) + 4*a^3*b)/(tan(d*x + c)^2 + 1))/d
 
3.1.81.9 Mupad [B] (verification not implemented)

Time = 22.91 (sec) , antiderivative size = 255, normalized size of antiderivative = 2.14 \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=\frac {a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-3\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+4\,a\,b^3\,\ln \left (\frac {1}{{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}\right )+6\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-4\,a\,b^3\,\ln \left (\frac {\cos \left (c+d\,x\right )}{\cos \left (c+d\,x\right )+1}\right )}{d}+\frac {\frac {a^4\,\sin \left (c+d\,x\right )}{8}+\frac {9\,b^4\,\sin \left (c+d\,x\right )}{8}+\frac {a^4\,\sin \left (3\,c+3\,d\,x\right )}{8}+\frac {b^4\,\sin \left (3\,c+3\,d\,x\right )}{8}+\frac {a\,b^3\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {a^3\,b\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {3\,a^2\,b^2\,\sin \left (c+d\,x\right )}{4}-\frac {3\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{4}}{d\,\cos \left (c+d\,x\right )} \]

input
int((a*cos(c + d*x) + b*sin(c + d*x))^4/cos(c + d*x)^2,x)
 
output
(a^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)) - 3*b^4*atan(sin(c/2 + (d 
*x)/2)/cos(c/2 + (d*x)/2)) + 4*a*b^3*log(1/cos(c/2 + (d*x)/2)^2) + 6*a^2*b 
^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)) - 4*a*b^3*log(cos(c + d*x)/ 
(cos(c + d*x) + 1)))/d + ((a^4*sin(c + d*x))/8 + (9*b^4*sin(c + d*x))/8 + 
(a^4*sin(3*c + 3*d*x))/8 + (b^4*sin(3*c + 3*d*x))/8 + (a*b^3*cos(3*c + 3*d 
*x))/2 - (a^3*b*cos(3*c + 3*d*x))/2 - (3*a^2*b^2*sin(c + d*x))/4 - (3*a^2* 
b^2*sin(3*c + 3*d*x))/4)/(d*cos(c + d*x))